Skip to content

v1.2.0#44

Merged
vdavez merged 1 commit into
mainfrom
budget-range-filters
Jun 5, 2026
Merged

v1.2.0#44
vdavez merged 1 commit into
mainfrom
budget-range-filters

Conversation

@makegov-mark
Copy link
Copy Markdown
Contributor

@makegov-mark makegov-mark Bot commented Jun 5, 2026

Summary

  • Expose the full range-filter surface on list_budget_accounts(). The REST endpoint at /api/budget/accounts/ has always supported __gte / __lte lookups on every numeric metric (the 26 fields in the backend's RANGE_NUMERIC_FIELDS); the SDK previously only forwarded identity / taxonomy filters, so callers were forced to discover accounts by exact symbol lookup.
  • Adds 78 explicit named kwargs (26 range fields × {exact, _gte, _lte}). Each maps to the API's field__gte / field__lte form. Per the SDK's filter-surface non-negotiable in CLAUDE.md, every new filter is an explicit typed parameter — no **kwargs passthrough. Mapping body is table-driven so the method body doesn't balloon with if val is not None blocks.
  • Why now: the upcoming makegov.com blog post on the budget endpoint's discovery story (PR makegov/makegov.com#29) wants to show this query:
    client.list_budget_accounts(
        fiscal_year=2024,
        contract_share_of_obligated_capped_gte=0.6,
        ba_growth_next_year_pct_gte=0.15,
        unobligated_balance_gte=200_000_000,
        ordering=\"-unobligated_balance\",
    )
    Before this PR, that wasn't expressible in the SDK at all.

Compatibility

  • Pure addition. Existing call sites are unaffected. Minor bump → 1.2.0.

Test plan

  • uv run ruff format + uv run ruff check tango/ tests/ clean
  • uv run mypy tango/Success: no issues found in 17 source files
  • uv run pytest tests/ -m \"not integration and not production\" — 302 passed
  • New unit tests cover: range filters serialize to field__gte / field__lte; default call (no filters) sends only paging + shape
  • Live API smoke test against tango.makegov.com returned the expected 8 FY2024 accounts for the discovery query and matched the response from a hand-built HTTP probe

The REST endpoint at /api/budget/accounts/ has always supported __gte /
__lte lookups on every numeric metric (the 26 fields in the backend's
RANGE_NUMERIC_FIELDS), but the SDK only forwarded identity / taxonomy
filters. Callers were forced to discover accounts by exact symbol
lookup; pipeline-style queries weren't expressible without dropping
to raw HTTP.

This change adds 78 explicit named parameters (each of the 26 range
fields × {exact, _gte, _lte}) so the discovery query "FY24 accounts
where contract share ≥ 60%, unobligated balance ≥ $200M, and next-year
growth ≥ 15%, sorted by largest headroom first" is a single SDK call.

Per the SDK's filter-surface non-negotiable, every new filter is an
explicit kwarg with a type hint — no **kwargs passthrough. Mapping body
is table-driven to keep the method readable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vdavez vdavez merged commit a14ba50 into main Jun 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant